All menu events are dispatched to OpenDoc via CADispatchMenuEvent(). CADispatchEvent() will
ignore both mouse down events in the menu bar, and menu command-key events.
CASetBaseMenuBar is called with the CA's menu bar resource handle. The CASession object builds
a base menu bar (Apple, File, Edit) and assigns it to the ODWindowState, it then creates an ODMenuBar object for the CA menu bar and sets it as the current menubar. At initialization the proxy part stores the CA menu bar so it can be displayed when the root frame acquires menu focus.
CAAdjustMenus() is called by the CA when a mousedown in the menubar occurs.
Used to register a menu pick as an command ID with the OD menubar RegisterCommand call. All shared real-estate furnished by the CA (File/Document & Edit menus) must contain the minimum required entries and each MUST be registered using this call.
Returns the current offset of document’s value stream.
pascal void CASetOffset( CADocumentRef document,
CASize offset )
Exceptions signaled:
kCAErrEndOfFile
Sets the current offset of document’s value stream.
pascal void CAInsert( CADocumentRef document,
char* buffer,
CASize* length )
Exceptions signaled:
none
Inserts length bytes into document’s value stream at the current offset.
pascal void CADelete( CADocumentRef document,
char* buffer,
CASize* length )
Exceptions signaled:
none
Deletes length bytes from document’s value stream at the current offset.
User Interface - CAUIEvt.cpp
Description
CAs continue to own the event loop. The major change is that the OpenDoc dispatcher should be given a chance to handle an event before the CA tries to handle it. If the dispatcher hasn’t handled it, the CA is free to. To make this work, the proxy part should simply answer FALSE for all HandleEvent calls, so that the CA can get a chance at them.
For the dispatcher to be able to find windows to dispatch events to, the CA must register all windows. This works for floating windows too.
There are getters for the sleeptime and mouseregion which the CA can pass to Get/WaitNextEvent();
API
The mouse region (returned by CAGetMouseRegion) should be passed in to the CA’s WaitNextEvent call if notification is desired when the mouse is moved out of the current part’s facet. The sleep time should always be passed to the GetNextEventCall...
Used to pass events received by the CA on into the embedded parts for processing. Returns TRUE if the event has been handled, FALSE if the CA must process the event. eventInfo is filled in appropriately.
Exceptions signaled:
none
pascal RgnHandle CAGetMouseRegion()
This returns the visible region of the facet surrounding/containing the cursor
Exceptions signaled:
none
pascal long CAGetSleepTime()
returns the minimum of _(RegisterIdle time)_ and (Caret time)
used to manually change the border when the border adjuster proc is not installed.
Exceptions signaled:
none
Undo - CAUndo.cpp
CAs can play with the OpenDoc undo strategy — however, there is no support for multiple undos hopping between CA and OD. Any undoable action in the CA’s native content will clear the OpenDoc undo stack. Undo menu events go first to the OD dispatcher. If the undo stack is clear, the event is passed to the CA.
API
pascal void CAClearUndo()
Exceptions signaled:
none
Window - CAWindow.cpp
Apps need to be aware of dependent or floating windows that parts may have opened. The application can make CALib calls to determine whether a window belongs to an OpenDoc part, find the frontmost non-floating window, activate a window, etc.
If an application does not have its own floating window support, CALib will use its own (based on the intrinsic support in the UI subsystem.) If an application already supports floating windows, we can't have two competing floating window managers so CALib will have to use the application's scheme. The application registers callbacks to its floating window management functions, and CALib will respect those callbacks.
Floating windows talk to OpenDoc API. Refer to Window Management callbacks.
The WindowActivate handler is a REQUIRED callback which must be implemented by the CA in order to receive activate/deactivate events due to OpenDoc internal design.
Called when a window is activated, deactivated by the internalWindowState. OpenDoc does not generate activate events. The WindowActivateHandler needs to call the CA's window activation/deactivation methods (if any). This is the only method of being notified of some OpenDoc internal activation events.
pascal CAWindowLayer CAIsPartWindow( WindowPtr w )
Returns a WindowLayer if the window belongs to an embedded part...
Exceptions signaled:
none
pascal WindowPtr CAGetFrontDocWindow( void )
Returns the frontmost document window, not including floating windows/palettes... Returns Nil of no windows are open.
Exceptions signaled:
none
pascal WindowPtr CAGetFrontFloatingWindow( void )
Returns the window pointer for the top most floater...Nil if none...
Exceptions signaled:
none
pascal void CASelectWindow( WindowPtr w )
If the window is a document window, brings it to the front of all other document windows and activates it. If the window is a floater, brings it to the front of all floating windows.
Removes CA window from OpenDoc so that the windows can be made to go away when a document is closed, etc...
Exceptions signaled:
none
CALib Private Modules
CAError.cpp
Description
This module contains CALib internal methods and macro definitions for failure handling.
CALib's failure handling mechanism CA_TRY, CA_CATCH_ALL and CA_ENDTRY is utilized in nearly all CALib functions. These macros automatically setup the global CA error value to be accessed by the CA.
API
void ClearCAError( )
Resets the global error variable. (Internal API only)
Exceptions signaled:
none
void SetCAError( OSErr err )
Default callback proc used by CALib. (Internal API only)
Exceptions signaled:
none
CADocPriv.cpp
Description
This module contains CADocument class implementations. CADocument, CAClipboardDocument, and CADragDropDocument are used internally by CALib.
CADisptch.cpp
Contains the CADispatcher class implementation.
CAFileUtils.cpp
File utility routines (previously contained by proxy shell).
This module contains CALib internal routines to handle mapping to/from CAFrameRef's, ODFrame*'s and ODID's.
A CAFrameRef is a StrongStorageUnitRef to an ODFrame, associated with the first value in the kODPropContents property of the proxy part. A CAFrameRef represents to the CA a persistent reference to a frame (valid across saves).